﻿namespace DAI.BaseFramework.DBConnection
{
    using System;

    public class DataType
    {
        public static string SwichDataType(DataTypeEnum type, string strValue)
        {
            switch (type)
            {
                case DataTypeEnum.Char:
                case DataTypeEnum.String:
                case DataTypeEnum.DataTime:
                case DataTypeEnum.TimeStamp:
                    return ("'" + strValue + "'");

                case DataTypeEnum.Blob:
                    return strValue;
            }
            if (strValue == "")
            {
                return "0";
            }
            return strValue;
        }

        public static string SwichDataType(int strDataType, string strValue)
        {
            switch (strDataType)
            {
                case 200:
                case 0xc9:
                case 300:
                case 0x12d:
                    return ("'" + strValue + "'");

                case 500:
                    return strValue;
            }
            if (strValue == "")
            {
                return "0";
            }
            return strValue;
        }

        public static string SwichDataType(string type, string strValue)
        {
            if ((((type == "Char") || (type == "String")) || (type == "DataTime")) || (type == "TimeStamp"))
            {
                return ("'" + strValue + "'");
            }
            if ((type != "Blob") && (strValue == ""))
            {
                return "0";
            }
            return strValue;
        }
    }
}

